<?php
include 'sql.php';
$proposal_id=$_POST['proposal_id'];
$score=$_POST['score'];
$content=$_POST['content'];

//测试用
// $proposal_id=1;
// $score=5;
// $content="222222";

//存进回复表
$time=time();
$sql="insert into proposal_discuss (RID,content,time,score) values ('$proposal_id','$content','$time','$score')";
SQL_query($sql);

//存进主表
$sql="select * from proposal_main where ID='$proposal_id'";
$arr=SQL_query($sql);
$arr=mysql_fetch_array($arr);
$score_time=$arr['score_time']+1;//评分总次数
$score_count=$arr['score_count']+$score;//总分，分开方便求平均分
$sql="update proposal_main set score_time='$score_time',score_count='$score_count' where ID='$proposal_id'";
SQL_query($sql);
// include'ajax_get_comments.php';
echo json_encode('true');
?>